package com.tcdp.daos;

import java.util.List;

import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;

import com.tcdp.models.Menu;

public class MenuDao extends AbstractDao {

	public List<Menu> retrieveMenus(){
		List<Menu> menus = null;
		
		CriteriaBuilder cb = em.getCriteriaBuilder();
		CriteriaQuery<Menu> cq = cb.createQuery(Menu.class);
		Root<Menu> root = cq.from(Menu.class);
		cq.select(root);
		TypedQuery<Menu> tq = em.createQuery(cq);
		menus = tq.getResultList();
		
		return menus;
	}
	
}
